<?php

namespace app\index\controller;

use app\common\model\Consult;
use app\common\model\ConsultBanner;
use app\index\logic\ArticleLogic;
use think\Db;
class Article extends Base
{

    public function index()
    {
        $banner = ConsultBanner::field('id,title,click_url,img')->where(['state'=>1])->order('id desc')->select();
        $lists = Consult::order(['sort'=>'asc','id'=>'desc'])->select();
        $this->assign('banner',$banner);
        $this->assign('list',$lists);
        $this->assign('web_title','资讯中心');
        return $this->fetch();
    }



    public function detail($id)
    {
        $r = (new ArticleLogic())->info($id);
        $this->assign('web_title','资讯详情');
        $this->assign('info',$r['info']);
        $this->assign('consult',$r['consult']);
        $this->assign('list',$r['list']);
        return $this->fetch();
    }

}